﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="KpiForm.aspx.cs" Inherits="kpi.KpiForm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>KPI指标模板</h2>
    <div>
        <table style="width: 100%;">
            <tr>
                <td style="text-align: center">
                </td>
                <td>&nbsp;
                </td>
            </tr>
            <tr>
                <td style="padding: 4px 2px 4px 0px; margin: 6px; vertical-align: middle; text-align: left">
                    用户：<asp:Label ID="Label_UserName" runat="server"></asp:Label>；
                    岗位：<asp:TextBox ID="TextBox_UserJobs" runat="server" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>
                    &nbsp;
                </td>
                <td style="padding: 4px 2px 4px 0px; margin: 6px; vertical-align: middle; text-align: left">&nbsp;
                </td>
            </tr>
        </table>
    </div>
    <div>
        <asp:Label ID="Label_CheckSumKpiRatMsg" runat="server" Text="Label" Visible="False"></asp:Label>
        <asp:Label ID="Label_SumInsKpiRat" runat="server" Text="Label" Visible="False"></asp:Label>
        <asp:GridView ID="GridView_UserKpiForm" runat="server" AutoGenerateColumns="False"
            DataKeyNames="id" DataSourceID="SqlDataSource_GridView_UserKpiForm" BackColor="White"
            BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" Font-Size="Small"
            ShowFooter="True" OnRowDataBound="GridView_UserKpiForm_RowDataBound">
            <Columns>
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id"
                    Visible="False" />
                <asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName"
                    Visible="False" />
                <asp:BoundField DataField="u_kpi" HeaderText="关键绩效指标（KPI）" SortExpression="u_kpi" />
                <asp:BoundField DataField="u_kpi_std" HeaderText="考核标准" SortExpression="u_kpi_std" />
                <asp:BoundField DataField="u_kpi_comm" HeaderText="KPI说明" SortExpression="u_kpi_comm" />
                <asp:BoundField DataField="u_kpi_rat" HeaderText="权重" SortExpression="u_kpi_rat">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="u_kpi_fx" HeaderText="计算方式" SortExpression="u_kpi_fx" />
                <asp:BoundField DataField="u_kpi_rec" HeaderText="自评得分" SortExpression="u_kpi_rec" Visible="False">
                    <ItemStyle HorizontalAlign="Right" />
                </asp:BoundField>
                <asp:BoundField DataField="uM_kpi_rec" HeaderText="考评得分" SortExpression="uM_kpi_rec" Visible="False">
                    <ItemStyle HorizontalAlign="Right" />
                </asp:BoundField>
                <asp:BoundField DataField="u_kpi_ref" HeaderText="信息来源" SortExpression="u_kpi_ref" Visible="False" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" InsertText="" NewText="确认" />
            </Columns>
            <EmptyDataTemplate>
                您没有任何可修改的KPI信息记录，请录入KPI信息。
            </EmptyDataTemplate>
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#330099" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <SortedAscendingCellStyle BackColor="#FEFCEB" />
            <SortedAscendingHeaderStyle BackColor="#AF0101" />
            <SortedDescendingCellStyle BackColor="#F6F0C0" />
            <SortedDescendingHeaderStyle BackColor="#7E0000" />
        </asp:GridView>
        <asp:Label ID="Label_SqlMsg" runat="server" Visible="False"></asp:Label>
        <%-- 我修改了INSERT的语句 --%>
        <%-- InsertCommand="INSERT INTO [u_kpi_table] ([id], [UserName], [u_kpi], [u_kpi_std], [u_kpi_comm], [u_kpi_rat], [u_kpi_fx], [u_kpi_rec], [uM_kpi_rec], [u_kpi_ref]) VALUES (@id, @UserName, @u_kpi, @u_kpi_std, @u_kpi_comm, @u_kpi_rat, @u_kpi_fx, @u_kpi_rec, @uM_kpi_rec, @u_kpi_ref)" --%>
        <%-- 我修改了UPDATE的语句 --%>
        <%-- UpdateCommand="UPDATE [u_kpi_table] SET [u_kpi] = @u_kpi, [u_kpi_std] = @u_kpi_std, [u_kpi_comm] = @u_kpi_comm, [u_kpi_rat] = @u_kpi_rat, [u_kpi_fx] = @u_kpi_fx, [u_kpi_ref] = @u_kpi_ref WHERE [id] = @original_id"--%>
        <asp:SqlDataSource ID="SqlDataSource_GridView_UserKpiForm" runat="server" ConflictDetection="CompareAllValues"
            ConnectionString="<%$ ConnectionStrings:kpi_forms_dbConnectionString %>"
            DeleteCommand="DELETE FROM [u_kpi_table] WHERE [id] = @original_id"
            InsertCommand="UPDATE u_kpi_table SET u_kpi_conf = 1 WHERE (id = @id)" OldValuesParameterFormatString="original_{0}"
            SelectCommand="SELECT [id], [UserName], [u_kpi], [u_kpi_std], [u_kpi_comm], [u_kpi_rat], [u_kpi_fx], [u_kpi_rec], [uM_kpi_rec], [u_kpi_ref] FROM [u_kpi_table] WHERE [UserName] = @UserName AND [u_kpi_conf] = 0"
            UpdateCommand="UPDATE [u_kpi_table] SET [u_kpi] = @u_kpi, [u_kpi_std] = @u_kpi_std, [u_kpi_comm] = @u_kpi_comm, [u_kpi_rat] = @u_kpi_rat, [u_kpi_fx] = @u_kpi_fx WHERE [id] = @original_id">
            <DeleteParameters>
                <asp:Parameter Name="original_UserName" Type="String" />
                <asp:Parameter Name="original_id" Type="Object" />
                <asp:Parameter Name="original_u_kpi" Type="String" />
                <asp:Parameter Name="original_u_kpi_std" Type="String" />
                <asp:Parameter Name="original_u_kpi_comm" Type="String" />
                <asp:Parameter Name="original_u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_fx" Type="String" />
                <asp:Parameter Name="original_u_kpi_rec" Type="Int32" />
                <asp:Parameter Name="original_uM_kpi_rec" Type="Int32" />
                <%--<asp:Parameter Name="original_u_kpi_ref" Type="String" />--%>
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="id" Type="Object" />
                <asp:Parameter Name="original_id" Type="Object" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="u_kpi" Type="String" />
                <asp:Parameter Name="u_kpi_std" Type="String" />
                <asp:Parameter Name="u_kpi_comm" Type="String" />
                <asp:Parameter Name="u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="u_kpi_fx" Type="String" />
                <asp:Parameter Name="u_kpi_rec" Type="Int32" />
                <asp:Parameter Name="uM_kpi_rec" Type="Int32" />
                <%--<asp:Parameter Name="u_kpi_ref" Type="String" />--%>
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="Label_UserName" Name="UserName" PropertyName="Text"
                    Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="id" Type="Object" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="u_kpi" Type="String" />
                <asp:Parameter Name="u_kpi_std" Type="String" />
                <asp:Parameter Name="u_kpi_comm" Type="String" />
                <asp:Parameter Name="u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="u_kpi_fx" Type="String" />
                <asp:Parameter Name="u_kpi_rec" Type="Int32" />
                <asp:Parameter Name="uM_kpi_rec" Type="Int32" />
                <asp:Parameter Name="u_kpi_ref" Type="String" />
                <asp:Parameter Name="original_UserName" Type="String" />
                <asp:Parameter Name="original_id" Type="Object" />
                <asp:Parameter Name="original_u_kpi" Type="String" />
                <asp:Parameter Name="original_u_kpi_std" Type="String" />
                <asp:Parameter Name="original_u_kpi_comm" Type="String" />
                <asp:Parameter Name="original_u_kpi_rat" Type="Int32" />
                <asp:Parameter Name="original_u_kpi_fx" Type="String" />
                <asp:Parameter Name="original_u_kpi_rec" Type="Int32" />
                <asp:Parameter Name="original_uM_kpi_rec" Type="Int32" />
                <%--<asp:Parameter Name="original_u_kpi_ref" Type="String" />--%>
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:Button ID="Button_UserConf" runat="server" Text="用户确认" OnClick="Button_UserConf_Click" Visible="False" />        
        <hr />
        <br />
        <asp:Label ID="Label_KpiMsg" runat="server" Text="KPI信息录入（每次一条KPI信息）" Font-Size="Medium"></asp:Label>
        <asp:Label ID="Label_ErrorMsg" runat="server" Visible="False"></asp:Label>
        <br />
        <table>
            <tr>
                <td style="width: 240px">关键绩效指标（KPI）<br />
                    [必须填写]
                </td>
                <td style="width: 240px">考核标准<br />
                    [必须填写]
                </td>
                <td style="width: 240px">KPI说明<br />
                    [必须填写]
                </td>
                <td style="width: 120px">权重<span style="color: #FF0000">[2位数字]</span><br />
                    [必须填写]
                </td>
                <td style="width: 240px">计算方式<br />
                    [选择填写]
                </td>
                <%--<td>
                    自评得分
                </td>
                <td>
                    考评得分
                </td>--%>
                <%--<td style="width: 160px">
                    信息来源
                </td>--%>
            </tr>
            <tr>
                <td style="width: 240px">
                    <asp:TextBox ID="TextBox_u_kpi" runat="server" Width="240px" BorderStyle="Solid"
                        BorderWidth="1px" TextMode="MultiLine"></asp:TextBox>
                </td>
                <td style="width: 240px">
                    <asp:TextBox ID="TextBox_u_kpi_std" runat="server" Width="240px" BorderStyle="Solid"
                        BorderWidth="1px" TextMode="MultiLine"></asp:TextBox>
                </td>
                <td style="width: 240px">
                    <asp:TextBox ID="TextBox_u_kpi_comm" runat="server" Width="240px" BorderStyle="Solid"
                        BorderWidth="1px" TextMode="MultiLine"></asp:TextBox>
                </td>
                <td style="width: 120px;">
                    <asp:TextBox ID="TextBox_u_kpi_rat" runat="server" Width="40px" BorderStyle="Solid"
                        BorderWidth="1px" Height="32px" MaxLength="2" onkeypress="if (event.keyCode<48 || event.keyCode>57) event.returnValue=false;"></asp:TextBox>
                </td>
                <td style="width: 240px">
                    <asp:TextBox ID="TextBox_u_kpi_fx" runat="server" Width="240px" BorderStyle="Solid"
                        BorderWidth="1px" TextMode="MultiLine"></asp:TextBox>
                </td>
                <%--<td>
                    <asp:TextBox ID="TextBox_u_kpi_rec" runat="server"></asp:TextBox>
                </td>
                <td>
                    <asp:TextBox ID="TextBox_u_M_kpi_rec" runat="server"></asp:TextBox>
                </td>--%>
                <%--<td style="width: 160px">
                    <asp:TextBox ID="TextBox_u_kpi_ref" runat="server" Width="160px" BorderStyle="Solid"
                        BorderWidth="1px" TextMode="MultiLine"></asp:TextBox>
                </td>--%>
            </tr>
            <tr>
                <td style="width: 240px">&nbsp;
                </td>
                <td style="width: 240px">&nbsp;
                </td>
                <td style="width: 240px">&nbsp;
                </td>
                <td style="width: 120px;">&nbsp;
                </td>
                <td style="width: 240px">&nbsp;
                </td>
                <%--<td style="width: 160px">
                    &nbsp;
                </td>--%>
                <%--<td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>--%>
            </tr>
        </table>
        <asp:Button ID="Button_Cf_Kpi_info" runat="server" Text="录入信息" OnClick="Button_Cf_Kpi_info_Click" ViewStateMode="Enabled" />
        <br />
    </div>
    <asp:Label ID="Label_UserGuide" runat="server" Visible="False"></asp:Label>
    <asp:Label ID="Label_DebugMsg" runat="server" Visible="False"></asp:Label>
</asp:Content>
